package com.qhs.sys.vo;

import com.qhs.sys.entity.SysMenuInfo;

import java.io.Serializable;
import java.util.List;

/**
 * Created by xinchao on 2017/1/18 0018.
 */
public class MenuVO implements Comparable<MenuVO>,Serializable{

    //父id
    private Long id;

    //父菜单节点
    private SysMenuInfo pm;

    //子菜单
    private List<SysMenuInfo> child;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public SysMenuInfo getPm() {
        return pm;
    }

    public void setPm(SysMenuInfo pm) {
        this.pm = pm;
    }

    public List<SysMenuInfo> getChild() {
        return child;
    }

    public void setChild(List<SysMenuInfo> child) {
        this.child = child;
    }

    @Override
    public boolean equals(Object obj) {
        MenuVO md = (MenuVO)obj;
        return md.getId()==this.getId();
    }

    public int compareTo(MenuVO o) {
        int tp = this.pm.getSort();
        int op = o.getPm().getSort();

        return tp>op?1:(tp==op?0:-1);
    }

    public MenuVO(Long pid, SysMenuInfo pm, List<SysMenuInfo> children) {
        this.id = pid; this.pm = pm; this.child = children;
    }

}
